from pathlib import Path
import logging


def dump_pta_to_csv(pta_df, file_path):
  columns = ['strategy_group', 'accounting_currency', 'trader', 'strategy_name',
             'pnl_mark', 'pnl_mark_in_usd', 'pnl_mark_from_fill',
             'pnl_mark_from_fill_in_usd',
             'turnover_mark', 'turnover_mark_in_usd']
  df = pta_df[columns].sort_values(
      by=['strategy_group', 'accounting_currency', 'trader', 'strategy_name'])
  Path(file_path).parent.mkdir(parents=True, exist_ok=True)
  df.to_csv(file_path, index=False)
  logging.info(f'pta summary saved successfully in {file_path}')
